
<link rel="stylesheet" href="jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" href="jquery/easyui/themes/icon.css">
<body>

<script>
function qq(value,name){
        alert(value+":"+name)
}
</script>

<div style="width: 100%;height: 98%">
    <table id="easyui_datagrid_source_fac" style="border:1px solid blue" >

    </table>
</div>


<script src="https://upload.shinehao.com.cn/20180816150739jquery-1.8.3.min.js"></script>
<script src="https://upload.shinehao.com.cn/20180816145716jquery.easyui.min.js"></script>
<script src="https://upload.shinehao.com.cn/20180816151727easyui-lang-zh_CN.js"></script>
<script>
var material_source_type = window.parent.getMyUrlQueryString(window.location.href,"material_source_type");
var uniqueid = window.parent.getMyUrlQueryString(window.location.href,"uniqueid");
var td_uniqueid = window.parent.getMyUrlQueryString(window.location.href,"td_uniqueid");
var tr_uniqueid = window.parent.getMyUrlQueryString(window.location.href,"tr_uniqueid");
var has_small_y = window.parent.getMyUrlQueryString(window.location.href,"has_small_y");
var ev = window.parent.getMyUrlQueryString(window.location.href,"ev");
var cpLock = false;
$(function(){
    
    $("body").bind("click",function(){
        $('#easyui_datagrid_source_fac').combogrid("showPanel");
    })
    $('#easyui_datagrid_source_fac').combogrid({
        mode:"remote",
        url:window.parent.serverUrl+"/createOrder/getOrderTabList",
        multiple:true, 
        queryParams: {
            type: 4
        },
        idField: 'text',
        textField: 'text',
        columns:[[
        	{field:'ck',checkbox:true},
            {field:'text',title:'组件名'},
            {field:'html_name',title:'颜色描述',hidden:true}
        ]],
        height:"10%",
        width:"80%",
        panelWidth:"100%",
        panelHeight:"88%",
        //rownumbers:true,
        fitColumnss:true,
        pagination:false,
        loadMsg:"加载中,请等待...",
        singleSelect:true,
        align:"center",
        //toolbar: '#easyui_datagrid_source_fac_tool',
        loadFilter: function(data){
          return data.data;  
        },
        keyHandler: {
            enter: function(e){
                filldata($('#easyui_datagrid_source_fac').combogrid("getValues"))
                $('#easyui_datagrid_source_fac').combogrid("showPanel");
            },
            query: function (q) {
            	setTimeout(function(){
	            	if(!cpLock){
	            		console.info($('#easyui_datagrid_source_fac').combogrid("getValue")+":"+q);
	                    $('#easyui_datagrid_source_fac').combogrid("grid").datagrid("reload", {
	                        type: 4,
	                        //material_type: material_source_type,
	                        'q': q,
	                    });
	                    $('#easyui_datagrid_source_fac').combogrid("setValue",q);
	            	}
            	},0);
                
            },
            up: function (e) {
                
            },
            down: function (e) {
                
            }
        },
        onLoadSuccess:function(data){
            /* if(data.total > 0) {
                $("input[type='text']").focus();
                return;
            }   */
            console.info(has_small_y)
            //色号描述改为颜色描述
            has_small_y=has_small_y.replace("色号描述","颜色描述");
            $($("input[type='checkbox']")[0]).hide(); 
            for ( var i = 0; i < data.rows.length; i++) {  
                    //根据status值使复选框 不可用  
                 if (has_small_y.indexOf(data.rows[i].text)>-1) {  
                     $($("input[type='checkbox']")[i + 1]).attr("disabled","disabled");  
                 }  
                 //20180525
				 /* if($("[name='order_s_feed_total']",parent.document).length>0){
					 if ("投料数"==data.rows[i].text) {  
	                     $($("input[type='checkbox']")[i + 1]).attr("disabled","disabled");  
	                 }  
				 }
				 if($("[name='order_s_order_total']",parent.document).length>0){
					 if ("订单数"==data.rows[i].text) {  
	                     $($("input[type='checkbox']")[i + 1]).attr("disabled","disabled");  
	                 }  
				 } */
				 
             }  
            //$(this).datagrid('appendRow', { color: '<div style="text-align:center;color:red">没有相关记录！</div>' }).datagrid('mergeCells', { index: 0, field: 'color', colspan: 3});  
            $("input[type='text']").focus();
            $('#easyui_datagrid_source_fac').combogrid("showPanel");
            
            
            $("input[type='text']").on('compositionstart', function () {
                cpLock = true;
            });
            $("input[type='text']").on('compositionend', function () {
                cpLock = false;
            });
        },
        /*onSelect:function(index,row){
            console.info(row);
            var self = $(window.parent.document).find("["+dom.split(":")[0]+"='"+dom.split(":")[1]+"']");
            //console.info("myid:"+$(self).attr("myid")+":"+$(self).length+":"+"'"+dom.split(":")[0]+"'");
            //console.info("id:"+$(self).attr("id")+":"+$(self).length+":"+"'"+dom.split(":")[0]+"'");
            //console.info($(self).attr("'"+dom.split(":")[0]+"'"));
            //物料代码 色号 颜色描述 规格 填充
            
            $("input[type='text']").focus();
            $('#easyui_datagrid_source_fac').combogrid("showPanel");
        },*/
        onClickRow:function(index,row){
            $("input[type='text']").focus();
            $('#easyui_datagrid_source_fac').combogrid("showPanel");
            $(this).datagrid('unselectRow', index);
        }
    });
    $('#easyui_datagrid_source_fac').combogrid("showPanel");
    $("input[type='text']").focus();
})
    
function filldata(data){
	console.info(data);
	console.info($('#easyui_datagrid_source_fac').combogrid('grid').datagrid('getChecked'))
    var rows = $('#easyui_datagrid_source_fac').combogrid('grid').datagrid('getChecked');
	window.parent.tbsourcefactoryColresizeEventForTwo.add_y_byuniqueId(uniqueid,rows.length,rows);
    window.parent.tbsourcefactoryColresizeEventForTwo.destroydialog(); 
}

</script>
</body>


























